package com.qunar.qcf.core.service;

import java.net.SocketAddress;
import java.util.Set;

import com.qunar.qcf.core.session.IoSession;
import com.qunar.qcf.core.session.IoSessionConfig;

/**
 * Provides meta-information that describes an {@link IoService}.
 *
 */
public interface TransportMetadata {
    
    /**
     * Returns the name of the service provider (e.g. "nio", "apr" and "rxtx").
     * 获得底层服务提供者名称
     */
    String getProviderName();

    /**
     * Returns the name of the service.
     * 获得服务名称
     */
    String getName();

    /**
     * Returns <code>true</code> if the session of this transport type is
     * <a href="http://en.wikipedia.org/wiki/Connectionless">connectionless</a>.
     */
    boolean isConnectionless();

    /**
     * Returns {@code true} if the messages exchanged by the service can be
     * <a href="http://en.wikipedia.org/wiki/IPv4#Fragmentation_and_reassembly">fragmented
     * or reassembled</a> by its underlying transport.
     */
    boolean hasFragmentation();

    /**
     * Returns the address type of the service.
     */
    Class<? extends SocketAddress> getAddressType();

    /**
     * Returns the set of the allowed message type when you write to an
     * {@link IoSession} that is managed by the service.
     */
    Set<Class<? extends Object>> getEnvelopeTypes();

    /**
     * Returns the type of the {@link IoSessionConfig} of the service
     */
    Class<? extends IoSessionConfig> getSessionConfigType();
}
